package com.labofjet.controller;

import java.io.IOException;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import com.labofjet.service.TestTransactionService1;

@Controller
public class TestController {
    Logger log = LoggerFactory.getLogger(TestController.class);

    @Autowired
    TestTransactionService1 testTransactionService1;

    /**
     * Spring 声明式事务学习
     * 
     * @return
     * @throws IOException
     * @author jiangyz
     */
    @RequestMapping("/test20")
    public Object index20() throws IOException {
        try {
            testTransactionService1.deleteAll();
            testTransactionService1.operate1();
        } catch (Exception e) {
            e.printStackTrace();
        }
        return null;
    }
    
    @RequestMapping("/test1")
    public Object index1() throws IOException {
        try {
            testTransactionService1.deleteAll();
            testTransactionService1.operate3();
        } catch (Exception e) {
            e.printStackTrace();
        }
        return null;
    }
}
